import { search } from '../../api/search'

export default {
  state: {
    data: ''
  },
  mutations: {
    SET_SEARCH (state, payload) {
      state.data = payload
    }
  },
  actions: {
    addSearch (store, word) {
      let searchData
      search(word).then(res => {
        searchData = res.data.data.list
        store.commit('SET_SEARCH', searchData)
      })
    }
  }
}
